<?php
class ListingBehavior extends CActiveRecordBehavior{
    
    public function getListingGoods(){
        $owner = $this->getOwner();
        $criteria = new CDbCriteria();
        $criteria->compare('scenic_id', $owner->id);
        $criteria->with = array('goods');
        $criteria->compare('goods.listing_status', 'ST_LISTING');
        $criteria->limit = 4;
        $data = GoodsScenic::model()->findAll($criteria);
        return empty($data) ? array() : $data;
    }
    
}
?>